package com.swsc.solarverse.schedule;

import com.swsc.solarverse.service.schedule.ForwardDataBackupScheduledService;

import java.time.LocalDateTime;

/**
 * @Author CHENCL-X99
 * @Date 2025/5/14 11:44
 * @Version 1.0
 * @Description 数据备份
 */
@lombok.extern.slf4j.Slf4j
@org.springframework.stereotype.Component
public class ForwardDataBackupScheduledTask {
    private final ForwardDataBackupScheduledService forwardDataBackupScheduledService;

    public ForwardDataBackupScheduledTask(ForwardDataBackupScheduledService forwardDataBackupScheduledService) {
        this.forwardDataBackupScheduledService = forwardDataBackupScheduledService;
    }

    @org.springframework.scheduling.annotation.Scheduled(cron = "0 50 23 * * ?")
    public void backupStringData() {
        LocalDateTime now = LocalDateTime.now();
        log.info("数据备份-开始...");
        forwardDataBackupScheduledService.backupStringData(now);
        log.info("数据备份-结束...");
    }
}
